#pragma once

#include <ClanLib/core.h>
#include <ClanLib/network.h>

namespace Network { class Client; }

namespace Account
{
	class AccountManager
	{
	public:
		AccountManager(Network::Client &client);
		~AccountManager();

		void update(const unsigned int &pulse_ms);
		bool isLoggedIn() const { return logged_in; }

		CL_NetGameEventDispatcher_v0 &getLoginEvents() { return login_events; }

	private:
		void onEventConnectionAccepted(const CL_NetGameEvent &e);
		void onEventConnectionDisconnected(const CL_NetGameEvent &e);
		void onEventLoginSuccess(const CL_NetGameEvent &e);
		void onEventLoginFail(const CL_NetGameEvent &e);

		Network::Client &client;
		CL_NetGameEventDispatcher_v0 login_events;
		bool logged_in;
	};
}
